<?php
namespace app\admin\controller;

class Shoplist extends Come{
    public function shoplist(){
        $reslist=db('admin_addshop')->select();

        $data=array();
        foreach($reslist as $val){
            $img=json_decode($val['img'],true);
            if($img!=NULL){
                $val['img']=$img;
            }
            $data[]=$val;
        }
        $this->assign('reslist',$data);
        return $this->fetch('shoplist');

    }
    public function delete(){
        $delId=input('param.delId','','htmlspecialchars');
        $res=db('admin_addshop')->where('id',$delId)->delete();
        if($res>0){
            $this->success('删除成功!','admin/shoplist/shoplist');
        }else{
            $this->error('删除失败');
        }
    }
}